package com.supermarket.seefood51.home.presenter

import android.content.Context
import com.supermarket.seefood51.entity.SeaFoodEntity
import com.supermarket.seefood51.home.model.HomeModel
import com.supermarket.seefood51.home.model.HomeModelImpl
import com.supermarket.seefood51.home.view.CarView
import com.supermarket.seefood51.home.view.HomeView
import com.supermarket.seefood51.home.view.ProductView
import com.supermarket.seefood51.linstener.OnLoadRequestListener


class CarPresenter(var context: Context, var view : CarView) : HomePresenter,OnLoadRequestListener<List<SeaFoodEntity>>{


    private var homeModel : HomeModelImpl = HomeModelImpl()

    override fun onSuccess(t: List<SeaFoodEntity>?) {
        view.notifyDataChange(t!!)
    }



    override fun onFail(e: Throwable?) {

    }

    override fun requestList(worNumber: String) {
        homeModel.requestList(context,worNumber ,this)
    }


    override fun addCart(t: SeaFoodEntity) {
        homeModel.addCart(t)
    }
}